/**
json的序列化
*/
package main

import (
	"encoding/json"
	"fmt"
)

type User struct {
	UserName string `json:"user_name"`  //这是波浪线的那个键
	Age      int
	Email    string
	Sex      string
}

func main()  {
	user := &User{
		UserName:"cici",
		Age:18,
		Email:"110@qq.com",
		Sex:"man",
	}
	data, err := json.Marshal(user)
	if err !=nil {
		return
	}
	fmt.Print(string(data))
}